package cn.kgc.validator;

import cn.kgc.annotation.CheckPmsBrandNameAnnotation;
import cn.kgc.entity.PmsBrand;
import org.apache.commons.lang.StringUtils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @description:
 * @author: 石浩杰
 * @date: 2022-11-28 09:48
 */
public class CheckPmsBrandNameValidator implements ConstraintValidator<CheckPmsBrandNameAnnotation, PmsBrand> {
    @Override
    public boolean isValid(PmsBrand pmsBrand, ConstraintValidatorContext constraintValidatorContext) {
        //品牌名为空，验证失败
        if (StringUtils.isNotBlank(pmsBrand.getName())){
            return false;
        }
        return true;
    }
}
